package SecondeStage.IO.PrintStream_Writer;

import java.io.FileWriter;
import java.io.IOException;
import java.io.PrintWriter;

public class PrintWriter_ {
    public static void main(String[] args) throws IOException {
        PrintWriter printWriter = new PrintWriter(System.out);
        printWriter.println("hi,北京");

        // 可以修改打印流输出的位置/设备
        PrintWriter printWriter2 = new PrintWriter(new FileWriter("D:\\Java\\JavaProject\\c.txt"));
        printWriter2.println("hi,北京");
        // 关闭流
        printWriter.close();
        printWriter2.close();
    }
}
